Skip to content

Fix legacy container restoration after dependency upgrade#144

Merged
Yashb404 merged 3 commits intochore/upgrade-depfrom
copilot/sub-pr-141-another-one
Feb 13, 2026
Merged

Fix legacy container restoration after dependency upgrade#144
Yashb404 merged 3 commits intochore/upgrade-depfrom
copilot/sub-pr-141-another-one

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 13, 2026

Containers created before the Axum upgrade couldn't reconnect because the restoration logic required session_id labels that didn't exist on pre-upgrade containers.

Changes

Legacy Container Restoration

  • Extract UUID from container name patterns (trycli-studio-viewer-{uuid}, trycli-studio-session-{uuid}) and use as session_id for containers without labels
  • Add name-based fallback matching in restore_specific_session() when label-based lookup fails

Prevent Duplicate Sessions

  • Add find_existing_viewer_container() to check for running containers before get_project() creates new session IDs
  • Reuse existing container session_id instead of generating new UUID on every project access

Code Quality

  • Extract calculate_session_created_at() helper to eliminate timestamp calculation duplication across 4 call sites

Example

Before:

// Only restored containers with session_id label
if let (Some(session_id), Some(names)) = (session_id, container.names) {
    // restore...
}

After:

// Handle both labeled and legacy containers
if let Some(session_id) = session_id {
    // restore with label
} else {
    // Extract UUID from name: trycli-studio-viewer-{uuid}
    let legacy_session_id = container_name.strip_prefix("trycli-studio-viewer-");
    // restore with extracted UUID
}

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 13, 2026 12:33
- Enhanced restore_sessions_from_containers to handle legacy containers
- Legacy containers are identified by name pattern (trycli-studio-viewer-* or trycli-studio-session-*)
- UUID from container name is used as session_id for legacy containers
- Added restore_specific_session fallback for legacy containers by name matching
- Added find_existing_viewer_container helper to reuse existing containers in get_project
- Modified get_project to check for existing viewer containers before creating new sessions
- Prevents creating duplicate sessions for pre-existing containers after dependency upgrade

Co-authored-by: Yashb404 <139128977+Yashb404@users.noreply.github.com>
- Extract timestamp calculation into helper function calculate_session_created_at
- Remove unused container_type variable
- Reduce code duplication across restoration functions

Co-authored-by: Yashb404 <139128977+Yashb404@users.noreply.github.com>
Copilot AI changed the title [WIP] Upgrade server dependencies and update routing Fix legacy container restoration after dependency upgrade Feb 13, 2026
Copilot AI requested a review from Yashb404 February 13, 2026 12:42
@Yashb404 Yashb404 marked this pull request as ready for review February 13, 2026 20:21
@Yashb404 Yashb404 merged commit bd4fecb into chore/upgrade-dep Feb 13, 2026
@Yashb404 Yashb404 deleted the copilot/sub-pr-141-another-one branch February 13, 2026 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants